package com.androidx.p013lv.invention.view;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.androidx.p013lv.base.bean.BoardListBean;
import com.androidx.p013lv.base.bean.InventionBean;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.listener.ItemClickListener;
import com.androidx.p013lv.base.p015ui.LazyFragment;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.invention.C1069R;
import com.androidx.p013lv.invention.OnInventionType;
import com.androidx.p013lv.invention.adapter.AdapterSix;
import java.util.ArrayList;
import java.util.List;

/* renamed from: com.androidx.lv.invention.view.SixView */
public class SixView {
    AdapterSix adapter;
    LinearLayout btn_more;
    String domain;
    Fragment fragment;
    InventionBean inventionBean;
    LinearLayout ll_content;
    Context mContext;
    List<SixItemView> mList = new ArrayList();
    OnInventionType onInventionType;
    int position;
    RecyclerView recycler;
    TextView tv_title;

    public SixView(View view, Fragment fragment2, String str, OnInventionType onInventionType2) {
        this.mContext = view.getContext();
        this.onInventionType = onInventionType2;
        this.domain = str;
        this.fragment = fragment2;
        this.tv_title = (TextView) view.findViewById(C1069R.C1072id.tv_title);
        this.recycler = (RecyclerView) view.findViewById(C1069R.C1072id.recycler);
        this.btn_more = (LinearLayout) view.findViewById(C1069R.C1072id.btn_more);
        this.ll_content = (LinearLayout) view.findViewById(C1069R.C1072id.ll_content);
    }

    public void setView(InventionBean inventionBean2, int i) {
        this.inventionBean = inventionBean2;
        this.position = i;
        this.tv_title.setText(inventionBean2.getStationName());
        initData();
        this.btn_more.setOnClickListener(new View.OnClickListener() {
            /* class com.androidx.p013lv.invention.view.SixView.View$OnClickListenerC11771 */

            public void onClick(View view) {
                SixView.this.onInventionType.onClick(SixView.this.inventionBean, SixView.this.position, view.getId());
            }
        });
    }

    /* access modifiers changed from: package-private */
    public void initData() {
        this.ll_content.removeAllViews();
        this.mList.clear();
        final int i = 0;
        while (i < this.inventionBean.getBoardList().size() && i <= 2) {
            SixItemView sixItemView = new SixItemView(this.fragment, this.inventionBean.getBoardList().get(i), i);
            this.ll_content.addView(sixItemView, new LinearLayout.LayoutParams(UiUtils.getWindowWidth() / 3, -2));
            sixItemView.setOnClickListener(new View.OnClickListener() {
                /* class com.androidx.p013lv.invention.view.SixView.View$OnClickListenerC11782 */

                public void onClick(View view) {
                    SixView sixView = SixView.this;
                    sixView.setRecycler(sixView.inventionBean.getBoardList().get(i));
                    int i = 0;
                    while (i < SixView.this.mList.size()) {
                        SixView.this.mList.get(i).setOnDefault(i == i);
                        i++;
                    }
                }
            });
            this.mList.add(sixItemView);
            i++;
        }
        if (this.inventionBean.getBoardList() != null && this.inventionBean.getBoardList().size() > 0) {
            setRecycler(this.inventionBean.getBoardList().get(0));
        }
    }

    /* access modifiers changed from: package-private */
    public void setRecycler(BoardListBean boardListBean) {
        if (this.adapter == null) {
            this.recycler.setLayoutManager(new LinearLayoutManager(this.mContext, 0, false));
            AdapterSix adapterSix = new AdapterSix(this.fragment, this.domain);
            this.adapter = adapterSix;
            this.recycler.setAdapter(adapterSix);
            this.adapter.setItemListener(new ItemClickListener() {
                /* class com.androidx.p013lv.invention.view.SixView.C11793 */

                @Override // com.androidx.p013lv.base.listener.ItemClickListener
                public void onItemClick(View view, int i) {
                    ((LazyFragment) SixView.this.fragment).startVideoPlay(((VideoBean) SixView.this.adapter.getDataInPosition(i)).getVideoId());
                }
            });
        }
        this.adapter.setData(boardListBean.getListVideo());
    }
}
